Find length of string without using built-in function in Python